package com.bwie.controller;

import com.bwie.Vo.PageProdVo;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/6/26 15:09
 * @Description:
 **/
@RestController
@RequestMapping("/shop/order")
public class OrderController {

    @Autowired
    TbOrderService tbOrderService;

    /**
     * 订单分页列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/GetOrderList")
    public R GetOrderList(@RequestBody PageInfoVo pageInfoVo){
        return tbOrderService.GetOrderList(pageInfoVo);
    }

    /**
     * 商品明细
     * @return
     */
    @PostMapping("/getProdInfoList")
    public R getProdInfoList(){
        return tbOrderService.getProdInfoList();
    }

    /**
     * 添加商品详细表
     * @param tbProdInfos
     * @return
     */
    @PostMapping("/addOrder")
    public R addOrder(@RequestBody List<TbProdInfo> tbProdInfos){
        return tbOrderService.addOrder(tbProdInfos);
    }

    /**
     * 导出订单列表
     */
    @GetMapping("/exportOrderList/{userId}")
    public void exportOrderList(@PathVariable("userId")Integer userId){
        tbOrderService.exportOrderList(userId);
    }

    /**
     * 批删
     * @param ids
     * @return
     */
    @PostMapping("/deleteOrderBatch")
    public R deleteOrderBatch(@RequestBody List<Integer> ids){
        return tbOrderService.deleteOrderBatch(ids);
    }
}
